var util = require('util');

function Pet(words) {
  this.words = words;
  this.speak = function() {
    console.log(this.words);
  };
}

Pet.prototype.eat = function() {
  console.log('Pet eat');
};

function Dog(words) {
  // Pet.call(this,words);
  Pet.apply(this,arguments);
  console.info(arguments);
}
// 继承原型链上的方法
util.inherits(Dog, Pet);

var dog = new Dog('wang');
console.log(Dog.super_ === Pet); // true
console.log(dog instanceof Dog); // true
console.log(dog instanceof Pet); // true
dog.speak();
dog.eat();